package com.zhoufy.tomcat.utils;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-03-27.
 *
 * @author zhoufy
 */
public class HttpProtocolUtil {

    public static String getHttpHeader200(long contentLength){
        return "HTTP/1.1 200 OK\n" +
                "Content-Type: text/html\n" +
                "Content-Length: "  + contentLength  + "\n" +
                "\r\n";
    }


    public static String getHttpHeader404(){
        String text = "<h1>404 not found </h1>";
        return "HTTP/1.1 404 NOT Found\n" +
                "Content-Type: text/html\n" +
                "Content-Length: "  + text.getBytes().length  + "\n" +
                "\r\n" + text;
    }
}
